<?php

namespace app\index\model;

use think\Db;

/**
 * @author xjy
 */
class HandoverModel
{

    static public function getHandoverList($param, $titles = null, $function = null)
    {
        $db = Db::table('sku_handover')->alias('a');
        !empty($param['sku']) && $db->where('a.sku', 'in', explodeStr($param['sku']));
        !empty($param['spu']) && $db->where('a.spu', 'in', explodeStr($param['spu']));
        !empty($param['developer']) && $db->where('a.developer', '=', $param['developer']);
        !empty($param['status']) && $db->where('a.status', $param['status']);
        if (!empty($param['creation_time'])) {
            $time = explode(' - ', $param['creation_time']);
            $db->where('a.creation_time', '>=', $time[0].' 00:00:00')->where('a.creation_time', '<=', $time[1].' 23:59:59');
        }
        $db->order('id','desc');
        return \app\common\service\ToolService::downOrReturn($db, $param, $titles, $function);
    }

}
